package com.silence.ByteDance;

import java.util.*;

// 小M的多任务下载器
public class easy_70 {
    public static int solution(int n, int[][] array) {
        // Edit your code here
        Map<Integer, Integer> map = new HashMap<>();
        int max = 0;
        for (int i = 0; i < n; i++) {
            int begin = array[i][0];
            int duration = array[i][1];
            for (int j = begin; j < begin + duration; j++) {
                map.put(j,map.getOrDefault(j,0)+1);
                max = Math.max(max, map.get(j));
            }
        }
        return max;
    }

    public static void main(String[] args) {
        // Add your test cases here
        System.out.println(solution(2, new int[][]{{1, 2}, {2, 3}}) == 2);
        System.out.println(solution(4, new int[][]{{1, 2}, {2, 3}, {3, 5}, {4, 3}}) == 3);
    }
}
